<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>订单项详情管理</title>
  <meta charset="utf-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <link rel="stylesheet" href="/layui/css/layui.css" media="all">
</head>
<body>
<span class="layui-breadcrumb" style="margin: 15px">
  <a href="/order">订单</a>
  <a><cite>详情</cite></a>
</span>
<table class="layui-hide" id="orderItem" lay-filter="orderItem"></table>

<script src="/layui/layui.js" charset="utf-8"></script>
<script src="/jquery/jquery-3.5.1.min.js"></script>
<script src="/utils.js"></script>

<script th:inline="none" type="text/javascript">
  layui.use(['table', 'form'], function () {
    const id = getQueryVariable("id");
    let table = layui.table;
    let form = layui.form;
    table.render({
      id: "orderItemTable",
      elem: '#orderItem',
      url: "/api/order/item/page",
      toolbar: true,
      method: 'post',
      title: '订单项信息表',
      cols: [[
        {type: 'checkbox', align: 'center', fixed: 'left', rowspan: 1},
        {field: 'id', align: 'center', title: 'id', width: 50, rowspan: 1},
        {field: 'commodityName', align: 'center', title: '商品名称', width: 150, rowspan: 1},
        {field: 'commodityImage', align: 'center', title: '商品图片', rowspan: 1},
        {field: 'price', align: 'center', title: '商品价格', rowspan: 1},
        {field: 'count', align: 'center', title: '商品数量', rowspan: 1},
        {field: 'amount', align: 'center', title: '价格合计', rowspan: 1},
        {field: 'createTime', align: 'center', title: '创建时间', hide: 'true', rowspan: 1},
        {field: 'remake', align: 'center', title: '备注', hide: 'true', rowspan: 1},
      ]],
      where: {
        id: id
      },
      page: true,
      request: {
        pageName: 'pageNum', //页码的参数名称，默认：page
        limitName: 'pageSize' //每页数据量的参数名，默认：limit
      },
      response: {
        statusCode: 200 //重新规定成功的状态码为 200，table 组件默认为 0
      },
      parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
        return {
          "code": res.code, //解析接口状态
          "msg": res.message, //解析提示文本
          "count": res.data.total, //解析数据长度
          "data": res.data.records//解析数据列表
        };
      }
    });
  });
</script>
</body>
</html>